package persi.casosDeUso;

import persi.hibernate.HibernateUtils;

public abstract class CasoDeUso {

	public CasoDeUso() {

	}

	public abstract void casoDeUso();

	public void ejecutar() {
		HibernateUtils.createSession();
		HibernateUtils.beginTransaction();
		try {
			this.casoDeUso();
			HibernateUtils.commit();
		} catch (final RuntimeException e) {
			HibernateUtils.rollback();
			throw e;
		} finally {
			HibernateUtils.closeSession();
		}
	}

}
